package org.budo.support.javax.sql.datasource;

import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.logging.Logger;

import javax.sql.DataSource;

import lombok.NoArgsConstructor;

/**
 * @author lmw
 */
@NoArgsConstructor
public class OneConnectionDataSource implements DataSource {
    private Connection connection;

    public OneConnectionDataSource(Connection connection) {
        this.connection = connection;
    }

    public Connection getConnection() throws SQLException {
        return this.connection;
    }

    public void close() {
    }

    public PrintWriter getLogWriter() throws SQLException {
        throw new RuntimeException();
    }

    public void setLogWriter(PrintWriter out) throws SQLException {
        throw new RuntimeException();
    }

    public void setLoginTimeout(int seconds) throws SQLException {
        throw new RuntimeException();
    }

    public int getLoginTimeout() throws SQLException {
        throw new RuntimeException();
    }

    public <T> T unwrap(Class<T> iface) throws SQLException {
        throw new RuntimeException();
    }

    public boolean isWrapperFor(Class<?> iface) throws SQLException {
        throw new RuntimeException();
    }

    public Connection getConnection(String username, String password) throws SQLException {
        throw new RuntimeException();
    }

    public Logger getParentLogger() {
        throw new RuntimeException();
    }
}